<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>块级盒子水平居中</title>
    <style>
        .header {
            width: 200px;
            height: 100px;
            background-color: pink;
            margin: 0 auto;

            text-align: center;
        }
    </style>
</head>
<body>
    <div class="header">
        <span>里面的元素</span><br>
        <img src="box-speak.png" alt="" width="50px">
    </div>
</body>
</html>